package com.ksm.web.controller.version;

import com.ksm.common.core.controller.BaseController;
import com.ksm.common.core.domain.AjaxResult;
import com.ksm.common.core.page.TableDataInfo;
import com.ksm.version.domain.SysServer;
import com.ksm.version.service.ServerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class VersionServerController extends BaseController {

    @Autowired
    private ServerService service;

    @GetMapping("/api/project/getAllServer")
    public TableDataInfo listServer() {
        startPage();
        return getDataTable(service.findAll());
    }


    @GetMapping("/api/project/getAllServerOp")
    public AjaxResult ServerList() {

        return AjaxResult.success(service.findAll());
    }



    @PutMapping("/api/project/addServer")
    public AjaxResult addServer(@RequestBody SysServer sysServer) {
        return AjaxResult.success(service.addProjectServer(sysServer));
    }

    @DeleteMapping("/api/project/delServerOne/{id}")
    public AjaxResult delServerOne(@PathVariable Integer id) {
        return AjaxResult.success(service.delServerOne(id));
    }

    @PostMapping("/api/project/updateServer")
    public AjaxResult updateServerOne(@RequestBody SysServer sysServer) {

        return AjaxResult.success(service.updateServer(sysServer));
    }
}
